
jQuery(function(){
    jQuery('ul.sf-menu').superfish();
//    $(".nano").nanoScroller();
});


    $(function(){
        //all hover and click logic for buttons
        $(".fg-button:not(.ui-state-disabled)")
        .hover(
            function(){ 
                $(this).addClass("ui-state-hover"); 
            },
            function(){ 
                $(this).removeClass("ui-state-hover"); 
            }
        )
        .mousedown(function(){
                $(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");
                if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
                else { $(this).addClass("ui-state-active"); }    
        })
        .mouseup(function(){
            if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button') ){
                $(this).removeClass("ui-state-active");
            }
        });
    });
    
    var $tabs;
    var ids = '';
    $(document).ready(function(){
        resizePage();
        
        $tabs = $( "#tabs1" ).tabs({ 
            cache: true
        });
    });
    
    $(window).resize(resizePage);
    
    function resizePage() {
        var height = $(window).height();
        var menu = $('#menu').height();
        $('#page').height(height - menu  + 100);
        var width = $(window).width();
        $('#info-bar').width(width - $('#menu').width()-188);
        var wmenu = $('#info-bar').find('.fg-buttonset').width();
        $('#fbanner').width($('#info-bar').width() - wmenu - 2);
        $('#ebanner').width($('#info-bar').width() - wmenu - 2);
    }
    



  var map;
function initialize(divid) {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById(divid));
    map.setCenter(new GLatLng(10.82313524364468, 106.62963151931763), 15);
     GEvent.addListener(map, "click", function(overlay,latlng) {
      if (latlng) {
           map.clearOverlays(); 
           map.addOverlay(new GMarker(latlng));
           switch(divid){
               case 'mapConfigurehotel_canvas':
               $("#frmconfigurehotel_hdlat").val(latlng.lat());
               $("#frmconfigurehotel_hdlng").val(latlng.lng());
               break;
               case 'map_canvas':
               $("#hdlat").val(latlng.lat());
               $("#hdlng").val(latlng.lng());
               case 'frmsearchhotel_canvas':
               $("#hdlatsearchhotel").val(latlng.lat());
               $("#hdlngsearchhotel").val(latlng.lng());
               break;
               default: break;                   
           }
      }
    });
    var customUI = map.getDefaultUI();
    customUI.maptypes.hybrid = false;
    map.setUI(customUI);
   
  }
}
function createMarker(lat,lng)
{ 
   map.clearOverlays();
   map.addOverlay(new GMarker(new GLatLng(lat,lng)));
   map.panTo(new GLatLng(lat,lng));
   $("#hdlat").val(lat);
   $("#hdlng").val(lng); 
    $("#frmconfigure_hdlat").val(lat);
    $("#frmconfigure_hdlng").val(lng);
} 
var stateResetSettings = {

        north__size:        "auto"

    ,    north__initClosed:    false

    ,    north__initHidden:    false

    ,    south__size:        "auto"

    ,    south__initClosed:    false

    ,    south__initHidden:    false

};
var myLayout;

$(document).keyup(function(e){            
   if(e.which==122){ 
   setTimeout('calH()',2000);
   }
});


$(document).ready(function () {
    


    myLayout = $('body').layout({

        north__slidable:        false    // OVERRIDE the pane-default of 'slidable=true'
        
    ,    north__spacing_closed:    0        // big resizer-bar when open (zero height)

    ,    south__resizable:        false    // OVERRIDE the pane-default of 'resizable=true'
    
    ,    south__togglerLength_closed: '100%'    // toggle-button is full-width of resizer-bar

    ,  spacing_open:    -1        // no resizer-bar when open (zero height)

    ,  spacing_closed:    -1        // big resizer-bar when open (zero height)

    ,    center__minWidth:        100
    ,    useStateCookie:            true

    });
    
$('#frmindex_feedback').dialog({
    autoOpen: false,
    modal: true,
    width: 500,
    resizable: true,
    overflow: 'auto' 
});

//    $('#frmindex_opencontact').dialog({
//        autoOpen: false,
//        modal: true,
//        width: 700,
//        height:500,
//        resizable: true,
//        overflow: 'auto' 
//    });
$('#frmchangepass_dialog').dialog({
    autoOpen: false,
    modal: true,
    width: 500,
    resizable: true,
    overflow: 'auto' 
});
 
initForm('frmindex_feedback');
initForm('frmchangepass_dialog');
 });
 
 $(function() {
$( "#radio" ).buttonset();
});
const Hheader = 30;
//const Hfooter = 60;
const Htab = 45;
const HFtble = 80;
//var htable = $(window).height()-Hheader-Hfooter-Htab-HFtble;
var htable = $(window).height()-Hheader-Htab-HFtble;
htable =  htable+"px";
var oTable ;
function calH(){
// htable = $(window).height()-Hheader-Hfooter-Htab-HFtble;
htable = $(window).height()-Hheader-Htab-HFtble;
}
var arrparamExport = new objParamsExport() ; 
var ObjExport = new ObjectExport() ;


function frmindex_sendRequest(){
$('#frmindex_feedback').dialog('option', 'title', 'Gửi ý kiến phản hồi');  
$('#frmindex_feedback').dialog('open');
}

function frmchangepass_open(){
$('#frmchangepass_divalert').text('');
$('#frmchangepass_txtOldPass').val('');
$('#frmchangepass_txtNewPass').val('');
$('#frmchangepass_txtNewPassConfirm').val('');
$('#frmchangepass_dialog').dialog('option', 'title', 'Đổi mật khẩu');  
$('#frmchangepass_dialog').dialog('open');
}

function ofc_ready()
{

}
function findSWF(movieName) 
{
if (navigator.appName.indexOf("Microsoft")!= -1) 
{
    return window[movieName];
} 
else 
{
    return document[movieName];
}
}

function open_flash_chart_data()    // bieu do nhien lieu chưa xu ly
{
// alert(data_chartincomebymonth);
return JSON.stringify(data_chartincomebymonth);
}

/* hàm biết đổi thời gian từ giây sang kiểu giờ:phút:giây*/
function creaeteTime(time,frm){   
     h = parseInt(time/3600);
     m = parseInt((parseInt(time%3600))/60);
     s = parseInt(time%60);
     sep =':';
     var d = new Date();
     var n = d.getSeconds(); 
     odd = n%2;
     if(odd==0){
        sep ='<font color="#5F98C1">:</font>';
     }
     
     h = h<10?'0'+h:h;
     m = m<10?'0'+m:m;
     s = s<10?'0'+s:s;
     result =''; 
     switch(frm){
         case 's': result=m+":"+s;break;
         case 'm': result=h+sep+m;break;
         case 'h': result=h ; break;
         default :result=h+":"+m+":"+s;break;
     }
     return result;
}

var data_chartincomebymonth;

var timePrevious = Date.now(); // thời gian trước đó để biết được là lệch thời gian bao nhiêu


